home *** CD-ROM | disk | FTP | other *** search
- #include "ModGetSetSamples.h"
-
-
- signed long GetSample16(Ptr samplePtr, short bps)
- {
- signed long mySample;
- short byte, numBytes, sampleSize;
-
- sampleSize = bps/8 + (bps%8 != 0);
- numBytes = (sampleSize < sizeof(long)) ? sampleSize : sizeof(long);
-
- for (byte = 0; byte < numBytes; byte++)
- *(unsigned char *)((long)&mySample+byte) = *(unsigned char *)(samplePtr+byte);
-
- mySample = mySample >> (sizeof(long)-numBytes) * 8;
-
- return mySample;
- }
-
-
- void SetSample16(Ptr samplePtr, signed long mySample, short bps)
- {
- Ptr myPtr;
- short byte, numBytes, sampleSize;
-
- sampleSize = bps/8 + (bps%8 != 0);
- numBytes = (sampleSize < sizeof(long)) ? sampleSize : sizeof(long);
-
- myPtr = samplePtr;
-
- for (byte = sizeof(long)-numBytes; byte < sizeof(long); byte++)
- *(unsigned char *)myPtr++ = *(unsigned char *)((long)&mySample+byte);
- }